package com.xiaotu.service;

import com.xiaotu.pojo.Dept;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import java.util.List;

@Component
public class DeptClientHystrixService implements FallbackFactory {
    @Override
    public Object create(Throwable throwable) {
        return new DeptClientService() {
            @Override
            public Dept queryById(Integer id) {
                return new Dept()
                        .setId(id)
                        .setName("id=>"+id+"不存在该用户,或者信息无法找到")
                        .setDbSource("no this database in MYSql");
            }
            @Override
            public List<Dept> queryAll() {
                return null;
            }
            @Override
            public Boolean addDept(Dept dept) {
                return null;
            }
        };
    }
}
